#pragma once
#include <string>
#include <vector>
#include <memory>
#include <utility>
#include <ctime>
#include <mutex>
#include <opencv2/opencv.hpp>

#include "common/model_config.h"
#include "model_struct.h"
#include "model_manager.h"

namespace ai {

struct BasePackPredictor {
  BasePackPredictor(): cfg(nullptr), input_count(0), output_count(0) { }
  std::vector<int> ori_im_shapes;
  int32_t input_count;
  int32_t output_count;
  int md_idx;
  std::string model_id;
  ModelConfig *cfg;
};


class BasePredictor {
public:
  BasePredictor(BasePackPredictor* model, ModelManager* manager, LogInfo *lg): 
  log_ifo(lg), mdl(model), mng(manager) {}
  virtual ~BasePredictor() {};

  int run_thread();
  int stop();

  virtual int RunDet(stream::ImageBlob* blob, std::vector<BaseInfo*>& det_infos) = 0;

public:
  LogInfo *log_ifo;
  std::mutex rec_mut;
  stream::ImageBlob* rec_data;
  std::atomic_int stop_flag;

  BasePackPredictor* mdl;
  ModelManager* mng;
};



}  // namespace ai
